package com.reactor.handler;

import org.w3c.dom.Element;

import com.reactor.handler.commands.SearchProductCommand;

public class CommandFactory {
	private static CommandFactory instance = null;
	private CommandFactory()
	{
		
	}
	public static CommandFactory getInstance()
	{
		if (CommandFactory.instance == null)
		{
			CommandFactory.instance = new CommandFactory();
		}
		return CommandFactory.instance;
	}
	
	public ICommand createCommand(String name , Element commandsBody)
	{
		ICommand command = null;
		if (name.equals(SearchProductCommand.SEARCH_PRODUCT_COMMAND))
		{
			command = new SearchProductCommand(commandsBody);
		}
		return command;
		
	}
}
